package org.xb.BeverageTemplate;

/**
 * @Author
 * @Description
 * @Date created in 15:52 2023/12/8
 */
abstract class BeverageTemplate {
    public final void makeBeverage() {
        boilWater();
        brew();
        pourInCup();
        addCondiments();
        hook();
    }
    protected abstract void brew();

    protected abstract void addCondiments();

    private void boilWater() {
        System.out.println("Boiling water");
    }

    private void pourInCup() {
        System.out.println("Pouring in cup");
    }
    //钩子方法 可以父类有默认实现
    protected void hook(){}
}
